﻿<div class="sample_title">Form Numeric</div>

sample:<br />
<div class="sample_preview">
    <script type="text/javascript"><!--//--><![CDATA[//><!--
        var f_calculate_good = function() {
            var ln_number = $('#number').getval();
            var ln_price = $('#price').getval();
            var ln_total = ln_number * ln_price;
            $('#total').setval(ln_total);
        };
        
        $(document).ready(function() {
            // Create Form
            $('#form4').setupForm([
                { name: 'number', type: 'numeric', noempty: true, onChange: f_calculate_good },
                { name: 'price', type: 'numeric', precision: 2, noempty: true, value:2000, onChange: f_calculate_good },
                { name: 'total', type: 'numeric', precision: 2, readonly:true }
            ]);
        });
    //--><!]]></script>
    <form id="form4" onsubmit="return false;">
    <table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0">
    <tr>
        <td class="label">Number of Goods</td>
        <td><input id="number" /></td>
    </tr>
    <tr>
        <td class="label">@Price</td>
        <td><input id="price" /></td>
    </tr>
    <tr>
        <td class="label">Total</td>
        <td><input id="total" /></td>
    </tr>
    </table>
    </form>
</div><br />
code:
<div class="sample_code" rel="brush: js; html-script: false;">
    &lt;script type="text/javascript"&gt
        var f_calculate_good = function() {
            var ln_number = $('#number').getval();
            var ln_price = $('#price').getval();
            var ln_total = ln_number * ln_price;
            $('#total').setval(ln_total);
        };
        
        $(document).ready(function() {
            // Create Form
            $('#form_master').setupForm([
                { name: 'number', type: 'numeric', noempty: true, onChange: f_calculate_good },
                { name: 'price', type: 'numeric', precision: 2, noempty: true, value:2000, onChange: f_calculate_good },
                { name: 'total', type: 'numeric', precision: 2, readonly:true }
            ]);
        });
    &lt;/script&gt;
        
    &lt;form id="form_master" onsubmit="return false;"&gt;
    &lt;table class="tb_form" style="display:none;" cellpadding="0" cellspacing="0"&gt;
    &lt;tr&gt;
        &lt;td class="label"&gt;Number of Goods&lt;/td&gt;
        &lt;td&gt;&lt;input id="number" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class="label"&gt;@Price&lt;/td&gt;
        &lt;td&gt;&lt;input id="price" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class="label"&gt;Total&lt;/td&gt;
        &lt;td&gt;&lt;input id="total" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
    <% for (int i = 0, max_i = 26; i < max_i; i++) { Response.Write("<br />"); } %>
</div><br />

<fieldset>
    <legend>Field Configuration</legend>
    <table class="tb_apiconfig">
    <tr>
        <td class="label">type</td>
        <td><font color="blue">(string) default: text</font><br />
            Set Type of field into <u>numeric</u>
        </td>
    </tr>
    <tr>
        <td class="label">precision</td>
        <td><font color="blue">(numeric) default: 0</font><br />
            Set Precision of number format (only used when <u>type</u> is <u>numeric</u>)
        </td>
    </tr>
    </table>
</fieldset>